package module.map.operations.base
{
	import drongo.desktop.utils.UtilsFile;
	
	import flash.filesystem.File;
	
	import common.operations.BaseOperation;
	
	import module.map.model.Propertys;
	
	public class SaveOperation extends BaseOperation
	{
		public function SaveOperation()
		{
			super();
		}
		
		override public function execute():void{
			if(this.project.currentMap){
				this.project.currentMap.Update(Propertys.STATE,0);
				var mapID:String=this.project.currentMap.Get(Propertys.ID).GetValue();
				//保存地图配置
				var configFile:File=new File(this.project.mapsFile.nativePath+File.separator+mapID+".json");
				var jsonData:Object=this.project.currentMap.Encode(0);
				UtilsFile.saveJson(configFile,JSON.stringify(jsonData,null," "));
			}
		}
	}
}